//
//  MapView.m
//  ShovelBattle
//
//  Created by Eleve on 13/03/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "MapView.h"
// Map actions

@implementation MapView

@synthesize squaresDictionary;

- (void)initForController
{
    squaresDictionary  = [[NSMutableDictionary alloc] init];
}

- (void)addSquareOnMapWithId:(NSNumber *)index andCoords:(CGPoint)coords
{
    
    SquareView *square = [[SquareView alloc] init];
    [square setFrame:CGRectMake(coords.x, coords.y, 40, 40)];
    [self addSubview:square];
    [square release];
    
    [squaresDictionary setObject:square forKey:index];
}

- (void)addTreasureOnMapWithId:(NSNumber *)index
{
    SquareView *square = [squaresDictionary objectForKey:index];
    [square addCross];
}

- (void)addHoleOnMapWithId:(NSNumber *)index
{
    SquareView *square = [squaresDictionary objectForKey:index];
    [square addHole];
}

- (void)addFoundTreasureOnMapWithId:(NSNumber *)index
{
    SquareView *square = [squaresDictionary objectForKey:index]; 
    [square addTreasure];
}

/*- (void)addTreasureOnMapWithCoords:(CGPoint)coords
{
    UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"treasureCross.png"]];
    [image setFrame:CGRectMake(coords.x, coords.y, 40, 40)];
    [self addSubview:image];
    [image release];
}*/

@end
